|
|
> I wound up having to have a macro call the second macro which called the
> third, etc until 16 or so. So I wrote 16 macros, when I bet I could have
> done it with a simple recursive macro. :(
Eek!
It looks like all of your macros are pretty much identical. All you need to
do is keep track of how many calls "deep" you are. You can do that with an
extra parameter, like this:
(I renamed "treeX" to "buildtree" so that it doesn't conflict with your
"tree" macro which actually makes an individual branch.)
#macro buildtree(aty,rotz, scl, depth)
union {
tree(0,0,1)
#if (depth = 15)
leave(8,atan2d(4,3),.75)
leave(7,-atan2d(3,4),.75)
#else
buildtree(8,atan2d(4,3),.75, depth+1) // depth increases with each call
buildtree(7,-atan2d(3,4),.75, depth+1)
#end
scale <scl,scl,scl>
rotate <0,72,rotz>
translate <0,aty,0>
}
buildtree(0,0,1, 0 /* initial depth of zero */)
By the way, "leave" should probably be "leaf"; the v is only used for the
plural ("leaves").
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|